import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import { URL, fileURLToPath } from "node:url"
import { viteMockServe } from "vite-plugin-mock"
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    react(),
    viteMockServe()
  ],
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("src", import.meta.url))
    }
  },
  server: {
    proxy: {
      '/api': {
        target: 'http://localhost:4000',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      },
    }
  }
})
